<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="李愧愧">
    <title></title>
    <style>
        span {
            text-align: center;
            display: inline-block;
            width: 100px;
            height: 30px;
            line-height: 30px;
        }

        .box1 span {
            background-color: #e5e5e5;
            border: 1px solid black;
        }
        .box2{
            border: 3px solid #9999ff;
            display: none;
        }
        .box2 span{
            color: blue;
        }
        .box2 span:nth-of-type(3) {

            border-top: 3px solid #9999ff;
        }

        .box2 {
            width: 100px;
            margin-top: 10px;
        }
    </style>
</head>

<body>

    <div class="box">
        <div class="box1">
            <span>输入法</span>
        </div>
        <div class="box2">
            <span>手写</span>
            <span>拼音</span>
            <span>关闭</span>
        </div>
    </div>
    <script>
        var box2 =document.querySelector('.box2');
        var box1 =document.querySelector('.box1');
        box1.onclick=function(ev){
            box2.style='display:block'
            ev.stopPropagation();
        }
        document.onclick=function(){
            box2.style='display:none'
        }


    </script>
</body>

</html>